#encoding:utf-8
from flask import Flask
from .exts import db
from .models import *
from . import config
from .main.views import *
import pymysql
pymysql.install_as_MySQLdb()

app = Flask(__name__)
app.config.from_object(config)
db.init_app(app)    #app文件是个堆栈，我们手动加进里面，不然无法运行

#将mian蓝图和app关联
from .main import main_blueprint
app.register_blueprint(main_blueprint)
# 将user蓝图和app关联
from .user import user_blueprint
app.register_blueprint(user_blueprint)

@app.route('/')
def hello_world():
    return 'Hello World!'

if __name__ == '__main__':
    app.run()